Telegram Group & Telegram Channel
Python dasturlash maktabi
Testlarni guruhlarga ulashing! 🗓MUNDARIJA: --------------------------- ⭕️ 1-bo'lim “Asosiy tushunchalar” Ⓜ️ Python nima? Ⓜ️ Birinchi dastur Ⓜ️ Oddiy operatsiyalar Ⓜ️ Haqiqiy sonlar Ⓜ️ Matnlar (strings) Ⓜ️ O'zgaruvchilar (Variables) Ⓜ️ Ma'lumotlarni olish…
Ⓜ️ *args va ** kwargs

Funksiya chaqirilganda argumentlar soni teng bo'lmasa TypeError xatoligini qaytaradi.


def func(argument1, argument2, argument3):
print(argument1 * argument2 + argument3)


func(2, 6)

TypeError: func() missing 1 required positional argument: 'argument3'


Funksiyalarda o'zgaruvchan miqdordagi argumentlarni uzatish uchun maxsus belgilardan *, ** foydalaniladi.

*args (kalit-qiymatsiz argumentlar)
**kwargs (kalit-qiymatli argumentlar)

args va kwargs shunchaki argumentlar ro'yxatiga berilgan nom.Bu nomni boshqa istalgan nomga o'zgartirishingiz mumkin.
Masalan: *kalitsiz va **kalitli. Lekin dastur biror jamoa tomonidan yoziladigan bo'lsa yoki dastur kodi sotilishi rejalashtirilgan bo'lsa argumentlar roʻyxatini args va kwargs kabi nomlash maqsadga muvofiqdir.

Argsga misol:

def func(arg1, *arg):
print('Birinchi argument: ' + arg1)
for i in arg:
print('Boshqa argument: ' + i)


func('@pythonuz', '@js_uz', '@phpuz', '@pyqt5')


Birinchi argument: @pythonuz
Boshqa argument: @js_uz
Boshqa argument: @phpuz
Boshqa argument: @pyqt5


Kwargsga misol:


def func(**kwarg):
for x, y in kwarg.items():
print('Kalit: ' + x, ' Qiymat: ' + y)


func(python='django', javascript='react', php='laravel')

Kalit: python Qiymat: django
Kalit: javascript Qiymat: react
Kalit: php Qiymat: laravel

@pythonuz



tg-me.com/pythonuz/540
Create:
Last Update:

Ⓜ️ *args va ** kwargs

Funksiya chaqirilganda argumentlar soni teng bo'lmasa TypeError xatoligini qaytaradi.


def func(argument1, argument2, argument3):
print(argument1 * argument2 + argument3)


func(2, 6)

TypeError: func() missing 1 required positional argument: 'argument3'


Funksiyalarda o'zgaruvchan miqdordagi argumentlarni uzatish uchun maxsus belgilardan *, ** foydalaniladi.

*args (kalit-qiymatsiz argumentlar)
**kwargs (kalit-qiymatli argumentlar)

args va kwargs shunchaki argumentlar ro'yxatiga berilgan nom.Bu nomni boshqa istalgan nomga o'zgartirishingiz mumkin.
Masalan: *kalitsiz va **kalitli. Lekin dastur biror jamoa tomonidan yoziladigan bo'lsa yoki dastur kodi sotilishi rejalashtirilgan bo'lsa argumentlar roʻyxatini args va kwargs kabi nomlash maqsadga muvofiqdir.

Argsga misol:

def func(arg1, *arg):
print('Birinchi argument: ' + arg1)
for i in arg:
print('Boshqa argument: ' + i)


func('@pythonuz', '@js_uz', '@phpuz', '@pyqt5')


Birinchi argument: @pythonuz
Boshqa argument: @js_uz
Boshqa argument: @phpuz
Boshqa argument: @pyqt5


Kwargsga misol:


def func(**kwarg):
for x, y in kwarg.items():
print('Kalit: ' + x, ' Qiymat: ' + y)


func(python='django', javascript='react', php='laravel')

Kalit: python Qiymat: django
Kalit: javascript Qiymat: react
Kalit: php Qiymat: laravel

@pythonuz

BY Python dasturlash maktabi


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/pythonuz/540

View MORE
Open in Telegram


Python dasturlash maktabi Telegram | DID YOU KNOW?

Date: |

Export WhatsApp stickers to Telegram on iPhone

You can’t. What you can do, though, is use WhatsApp’s and Telegram’s web platforms to transfer stickers. It’s easy, but might take a while.Open WhatsApp in your browser, find a sticker you like in a chat, and right-click on it to save it as an image. The file won’t be a picture, though—it’s a webpage and will have a .webp extension. Don’t be scared, this is the way. Repeat this step to save as many stickers as you want.Then, open Telegram in your browser and go into your Saved messages chat. Just as you’d share a file with a friend, click the Share file button on the bottom left of the chat window (it looks like a dog-eared paper), and select the .webp files you downloaded. Click Open and you’ll see your stickers in your Saved messages chat. This is now your sticker depository. To use them, forward them as you would a message from one chat to the other: by clicking or long-pressing on the sticker, and then choosing Forward.

China’s stock markets are some of the largest in the world, with total market capitalization reaching RMB 79 trillion (US$12.2 trillion) in 2020. China’s stock markets are seen as a crucial tool for driving economic growth, in particular for financing the country’s rapidly growing high-tech sectors.Although traditionally closed off to overseas investors, China’s financial markets have gradually been loosening restrictions over the past couple of decades. At the same time, reforms have sought to make it easier for Chinese companies to list on onshore stock exchanges, and new programs have been launched in attempts to lure some of China’s most coveted overseas-listed companies back to the country.

Python dasturlash maktabi from hk


Telegram Python dasturlash maktabi
FROM USA